home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 14 / CU Amiga Magazine's Super CD-ROM 14 (1997)(EMAP Images)(GB)(Track 1 of 3)[!][issue 1997-09].iso / CUCD / Programming / Mesa-2.2 / Mesa2_2ASrc1_6.readme < prev    next >
Encoding:
Text File  |  1997-07-02  |  10.6 KB  |  297 lines

  1. Short:    3D library, OpenGL based, Amiga v1.6
  2. Author:   brianp@ssec.wisc.edu (BrianP) Amiga Port: d94sz@efd.lth.se (Stefan Zivkovic)
  3. Uploader: d94sz@efd.lth.se (Stefan Zivkovic)
  4. Version:  Mesa v2.0 Amiga version 1.6
  5. Type:     dev/c
  6. Requires: System v39, SAS 6.57 or GCC.
  7. Replaces: dev/c/Mesa-2.0_Amiga-1.5.lha
  8.  
  9.                 The Mesa 3-D graphics library
  10.  
  11.              Copyright (C) 1995-1996  Brian Paul
  12.  
  13.  
  14.  
  15. Introduction
  16. ============
  17.  
  18. Mesa is a 3-D graphics library with an API which is very similar to that
  19. of OpenGL*.  To the extent that Mesa utilizes the OpenGL command syntax
  20. or state machine, it is being used with authorization from Silicon Graphics,
  21. Inc.    However, the author makes no claim that Mesa is in any way a
  22. compatible replacement for OpenGL or associated with Silicon Graphics, Inc.
  23. Those who want a licensed implementation of OpenGL should contact a licensed
  24. vendor.    This software is distributed under the terms of the GNU Library
  25. General Public License, see the LICENSE file for details.
  26.  
  27. * OpenGL(R) is a registered trademark of Silicon Graphics, Inc.
  28.  
  29. Miscellaneous
  30. =============
  31.  
  32. There is a Amiga Mesa WWW page:    http://www.efd.lth.se/~d94sz/amesa
  33. and the orginal  Mesa WWW page:    http://www.ssec.wisc.edu/~brianp/Mesa.html
  34.  
  35.  
  36. Since the OpenGL API is used, OpenGL documentation can serve as the
  37. documentation for Mesa's core functions.  Here are a few sources:
  38.  
  39.   Man pages:     http://www.digital.com:80/pub/doc/opengl/
  40.   Spec doc:      http://www.sgi.com/Technology/openGL/glspec/glspec.html
  41.  
  42.  
  43. Author
  44. ======
  45.  
  46. Brian Paul
  47. Space Science and Engineering Center
  48. University of Wisconsin - Madison
  49. 1225 W. Dayton St.
  50. Madison, WI  53706
  51.  
  52. brianp@ssec.wisc.edu
  53.  
  54.  
  55. AMIGA PORT of MESA: THE OPENGL SOFTWARE EMULATION by Stefan Zivkovic
  56. ====================================================================
  57. When I first read about OPENGL in the summer of 1995 I was happy and filled with
  58. joy. A few days later I surfed to the mesa homepage but only to discover that 
  59. there was no Amiga version. In the beginning of 1996 someone released a AMIWIN
  60. version so I took the archive home to try it out, but it stayed packed on my HD.
  61. One day when I was home and playing around with my HD I saw the archive and
  62. started to try to make it work. Without luck as it seemed that you needed 
  63. the AMIWIN Includes and LIBFILES. But I also discovered that it was possible
  64. to port it with not to much effort (WRONG THERE) so I begun.
  65.  
  66. For the Amiga there is only three important files + one directory.
  67.  
  68. src/Amigamesa.c        The mesa GL Amiga implementation 
  69.             (ddsample.c with some Amiga code)
  70. src-tk/Awindow.c    The tk (and aux) machine specific code)
  71. include/GL/Amigamesa.h    The prototypes for Amigamesa
  72.  
  73. Amiga/#?
  74.  
  75. Installing
  76. ==========
  77. If you have the big archive you just have to unpack is where you want it.
  78. If you have the updatepackage you need the orginal mesa archive and then
  79. you will nead lha in your path and run the installer script in /amiga 
  80. (or just unpack AMesa.lha yourself)
  81.  
  82.  
  83. Compiling
  84. =========
  85. If you use SAS just execute mklib.amiga (will appear if you have installed it correctly)
  86. For compiling with gcc you have to enter the command "make amiga-gcc". Via the 
  87. environment variable LOCALFLAGS you can specify additional optimizations (for instance -m68040).
  88.  
  89. To use CyberGfx you have to define ADISP_CYBERGFX in include/gl/amigamesa.h
  90. (you nead the includes for it (ftp.phase5.de))
  91.  
  92. About the code.
  93. ===============
  94. The Code is compiled with cpu=020 math=ieee 
  95. If you would like it different then use the /Amiga/scoptions read next statement
  96. The code is by defult amiga standard graphics If you for some unknown don't want
  97. this there is a define in top of  include/gl/amigamesa.h
  98.  
  99. The common scoptions file is in /Amiga
  100. Here exists a scoption that is used in the WHOLE package, change math here
  101. and it will reflect in all dirs
  102.  
  103. In /Amiga/library there are previews of files to the shared-library version
  104. (This doesn't work yet but should give you an idea of how to use it)
  105.  
  106. In /Amiga/Examples there should be some amiga-demo code,
  107. but I've got no code yet so feel free to send me your own examples.
  108.  
  109. All tk actions in tkExec are not finished. But most of them is. (low priority)
  110.  
  111. Most of the examples work. (ALL?)
  112.  
  113. etc. etc.
  114.  
  115. Write your own OpenGL code
  116. ==========================
  117. 1. For a easy start, look at the examples in /book/ and modify them
  118.    The examples uses a portable layer toolkit Not amiga specific at all
  119.  
  120. Until The shared library is ready you have to define AMIGALIB when
  121. using <GL/gl.h>
  122.  
  123. 2. For a better amigaprogram just open a window (on your favourite screen) and
  124.     add a few lines in your source:
  125.  
  126. -----------------------------------------------------------------------------
  127. /* ADD where you want it  */
  128. #include <GL/gl.h>
  129.  
  130. Init()         /* sets up viewport and projections */
  131.   {
  132.   glMatrixMode (GL_PROJECTION);      /*    prepare for and then */ 
  133.   glLoadIdentity ();         /*  define the projection */
  134.   glFrustum (-1.0, 1.0, -1.0, 1.0, 1.5, 20.0);/*  transformation */
  135.   glMatrixMode (GL_MODELVIEW);    /*  back to modelview matrix*/
  136.   glViewport (0, 0, 200, 200);    /*  define the viewport     */
  137. }     /*          ^  ^  ^^^  ^^^--- The size of the mesa/openGL window  */
  138.     
  139.  
  140.  
  141. /* ADD In after you opened your window */
  142.  
  143. struct amigamesa_context *glcont;
  144.  
  145.     glcont=AmigaMesaCreateContextTags( 
  146.                         AMA_DrawMode,AMESA_AGA,
  147.                         AMA_Window,(unsigned long)        test_window,    // My Windowptr
  148.                         AMA_RastPort,(unsigned long)    test_window->RPort,
  149.                         AMA_Screen,(unsigned long)        test_window->WScreen,
  150.                         AMA_DoubleBuf,                        GL_FALSE, // or GL_TRUE
  151.                         AMA_RGBMode,                        GL_TRUE, //   -"-
  152.                         AMA_Left,                            test_window->BorderLeft,          // offset from left edgr
  153.                         AMA_Bottom,                            test_window->BorderBottom+1,    // offset from bottom edgr
  154.                         TAG_DONE,0);
  155.  
  156. // Neaded tags is   AMA_RastPort,AMA_Screen   if you supply AMA_Window
  157. // it looks for RastPort and Screen in it so a Window_ptr will do.
  158.  
  159. if (glcont)
  160.  {
  161.  AmigaMesaMakeCurrent(glcont,glcont->buffer);
  162.  /* All your gl comands */
  163.  /*handle_window_events(test_window);    or whatever */
  164.  AmigaMesaDestroyContext(glcont);
  165. }
  166.  
  167. /* Don't forget to call glViewport() when you resize the window */
  168. ------------------------------------------------------------------------------
  169. if you set doublebuff to GL_TRUE then you just switch buffer with
  170. AmigaMesaSwapBuffers(glcont);
  171.  
  172. For more info on the internal of the Amiga port you can check the files
  173.   src/Amigamesa.c and include/GL/Amigamesa.h for tk check src-tk/Awindow.c
  174. And info on how to write your own gfx-routines read include/GL/amigamesa.h for
  175. more instructions.
  176.  
  177. THINGS THAT MAY GO WRONG
  178. ========================
  179. Remember GL ALWAYS render with (0,0) in the BOTTOM left corner.
  180.  
  181. If you use SAS you have to use the latest version (v 6.57), there is some bugs
  182.  in the older version's you can get free upgrades on aminet.
  183.  
  184.  
  185. WARNING The api has changed on AmigaMesaCreateContext() it is now called with
  186.     a taglist. Read /include/GL/amigamesa.h
  187.  
  188. Scoptions that should not be changed is  Precision=MIXED, NoStackExtend, NoStackCheck.
  189.  
  190. It compiles but all examples crash everytime: 
  191.     Set your stack high about 50kb or more.
  192.  
  193. Linking complains about not finding _glBegin(): or @glBegin():
  194.     You have compiled some code using the stack and some using registers as
  195.     parameter passing, You have to chose one of them and us it on both places.
  196.  
  197. The colors are really bad:
  198.     To emulate 24bit I alloc 255 colors in the beginning spread over the
  199.     palette and then use it. If you'd like better colors, buy a GFX-Card.
  200.     (And wait for gfx-card versions.)
  201.  
  202. Resizing is sometimes very very unhealthy.
  203.  
  204. Please keep in mind that since SAS pre 6.57 contains a few bugs thats could give you 
  205. problem please use the latest version of SAS (Aminet contains a uppgrade). 
  206. I have many users that repordet problems that disapered when thay upgaded SAS to 6.57
  207.  
  208.  
  209. LATEST VERSION:
  210. ===============
  211. http://www.efd.lth.se/~d94sz/amesa
  212.  
  213. TODO:
  214. =====
  215. Debugg.
  216. Fix resizing bug.
  217.  
  218.  
  219. FUTURE:
  220. =======
  221. A shared library would be nice. (I have started)
  222. Faster and better. (You may have some nice idea?)
  223.  
  224. HISTORY:
  225. ========
  226.         
  227. Release:
  228. 0.8 This code worked with Mesa 1.2.6 and all makefiles also.
  229.      But when I released it, Mesa 1.2.7 was released and some changes were made.
  230.      It didn't work.
  231.  
  232. 0.9 Makefiles is remapped to work with Mesa 1.2.7.
  233.      Double buffering works.
  234.      Implemented fast_poly_draw (big speed improvement).
  235.      tkExec a few more tests were done. (right & middle mousebutton is not
  236.      implemented)
  237.  
  238. 1.0 I've put a common scoption file in /Amiga (thanks to Kamil Iskra).
  239.      Due to the common scoptions you can change CPU and math more easy ,and
  240.      compiler options set to default math=ieee, cpu=020 so that it works on 
  241.      1200's and up 
  242.      Many bugfixes (thanks to Daniel Jönsson).
  243.      Have fixed the smakefile name collision with AMIWIN version.
  244.      Mesa 1.2.8 Fixed.
  245.      Spellcorrection of the docs were made by Peter Sandén.
  246.      (Blame him, not me!) 
  247.      All tk's windows are opened on a pubscreen named "MESA" if it exists.
  248.  
  249. 1.1 Faster and more stable (Many thanks to Jorge Acereda (JAM))
  250.      Faster pen usage now it allocates 255 pens and use them (thanks to
  251.      Stefan Burström)
  252.      A few enhancements here and there.
  253.      Fixed a smake bug ignore=A only works in the latest SAS version. Now I
  254.      have changed it to IGN=ALL (Thanx to everyone who reported this one)
  255.  
  256. 1.2 Removed math from smakefiles, SAS handles this better self. (Kamil Iskra)
  257.      Fixed a serious drawing bug (appeared when using GL_SMOTH).
  258.     Fixed a very flexible programming API for future gfx-board implementations
  259.      Added a BOOL AmigaMesaSetDefs(struct TagItem *tagList); usefull for future enhancements
  260.     ***'API change: AmigaMesaCreateContext uses taglist se include/GL/amigamesa.h
  261.     Faster on doublebuffer rendering. (Now I convert whole double buffer c2p)
  262.     Easier to integrate future gfx-cards routines. Look in include/GL/amigamesa.h
  263.     tk toolkit fixed to work better. Thanks to Georg 'Wulf' Krämer
  264.  
  265. 1.4 Uppdated to reflect Mesa 2.0
  266.      Small Bugfixes. Relesed With Mesa 2.0
  267.  
  268. 1.5 A few bugs intruduced in 1.4 was fixed (a workaround SAS oml/slink bug)
  269.     Due to a bug in SAS (oml/slink) 1.4 didn't work, this version should work better.
  270.     
  271. 1.6 I haved splitted amigamesa into amigamesa and ADisp_AGA.c
  272.     this ensures higer modularity, and becomes easier to se what is neaded to port
  273.     if you want to make your own gfx rutines.
  274.     ADisp_Cyb.c contains CyberGFX drawer rutines (Joerg Nilson)
  275.     It's also posible to use gcc now. (Joerg Nilson)
  276.     Now works with mesa 2.2.
  277.  
  278.  
  279. Due to my lack of time this will be my last relese of mesa, If you are interested to take over and mainten the source
  280. please feel free to do so, Just please let me know so I can put some info on my webpage.
  281.  
  282.  
  283.  
  284. Please contact me with suggestions and additional info. 
  285. You can reach me at: 
  286.  
  287. d94sz@efd.lth.se
  288.  
  289. Or mail:
  290.  
  291. Stefan Zivkovic
  292. Kämnärsv. 9L:225
  293. 226 46 LUND
  294.  
  295. Or Phone:
  296. +46 46 150763
  297.